From 1a84378c4e2a10798673c331827639e0a91a5d2d Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 7 Jun 2011 15:25:05 +0000 Subject: [PATCH] Rick adds better URL handling to Navicache. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4068 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/navicache.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gpsbabel/navicache.c b/gpsbabel/navicache.c index 3c4ea7ce1..3d7936a94 100644 --- a/gpsbabel/navicache.c +++ b/gpsbabel/navicache.c @@ -38,6 +38,7 @@ arglist_t nav_args[] = { #define MYNAME "navicache" #define MY_CBUF 4096 +#define NC_URL "http://www.navicache.com/cgi-bin/db/displaycache2.pl?CacheID=" #if ! HAVE_LIBEXPAT static void @@ -122,7 +123,11 @@ nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) for (ap = attr; *ap; ap+=2) { if (0 == strcmp(ap[0], "cache_id")) { + int id; + wpt_tmp->shortname = xstrdup(ap[1]); + id = atoi(ap[1]); + xasprintf(&wpt_tmp->url, "%s%d", NC_URL, id); } else if (0 == strcmp(ap[0], "name")) { wpt_tmp->description = xstrdup(ap[1]); @@ -153,8 +158,6 @@ nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) gc_data->terr = x * 10; } else if (0 == strcmp(ap[0], "cache_type")) { - static char buf[512]; - gc_data->type = nc_mktype(ap[1]); if (!strcmp(ap[1], "normal")) wpt_tmp->icon_descr = "Geocache-regular"; @@ -163,8 +166,8 @@ nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) else if (!strcmp(ap[1], "moving_travelling")) wpt_tmp->icon_descr = "Geocache-moving"; else { - sprintf(buf, "Geocache-%-.20s", ap[1]); - wpt_tmp->icon_descr = xstrdup(buf); + xasprintf(&wpt_tmp->icon_descr, + "Geocache-%-.20s", ap[1]); } } else if (0 == strcmp(ap[0], "hidden_date")) { -- 2.30.2